
#ifndef _SRC_MQTT_MQTTVALIDOR_H_
#define _SRC_MQTT_MQTTVALIDOR_H_

#include "Entity.h"
#include "MQTT/Params.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief mqtt 增加流量计数
 * @param entity
 */
void mqttFlowControlInc(MQTTEntity *entity);
/**
 * @brief 减少流量计数
 * @param entity
 */
void mqttCheckFlowDec(MQTTEntity *entity);
/**
 * @brief 检查流量控制
 * @param entity
 * @param qos
 * @return
 */
int32_t mqttCheckFlowControl(MQTTEntity *entity, uint8_t qos);
/**
 * @brief 检查topic 是否有效
 * @param topic
 * @param len
 * @return
 */
int32_t mqttCheckTopicValid(char *topic, uint32_t len);
/**
 * @brief 获取MQTT 包id
 * @param entity
 * @return
 */
uint16_t getMqttPacketId(MQTTEntity *entity);
/**
 * @brief 检查mqtt tx payload 长度
 * @param entity
 * @param pktLen
 * @return
 */
int32_t mqttCheckTXPayloadLen(MQTTEntity *entity, uint32_t pktLen);
/**
 * @brief 检查鉴权信息是否满足要求
 * @param entity
 * @return
 */
int32_t checkAuthInfo(MQTTEntity* entity);
/**
 * @brief mqtt 通用属性是否有效
 * @param property
 * @return
 */
int32_t mqttGeneralPropertyValid(GeneralProperty *property);
/**
 * @brief 获取通用属性长度
 * @param generalProp
 * @return
 */
uint32_t getGeneralPropertyLen(GeneralProperty *generalProp);
/**
 * @brief mqtt 清空
 * @param entity
 */
void cleanMqttSign(MQTTEntity *entity);




#ifdef __cplusplus
}
#endif
#endif //_SRC_MQTT_MQTTVALIDOR_H_
